/**************************************************************************(C)*
 *
 *  This file is part of the GreenHills project
 *  Copyright (C) 2009  Tieto Corporation
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  Not for commmercial use. Only with Tieto permission.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *************************************************************************(C)*/

#pragma once

#include <QtGui/QMainWindow>

class QTableView;

namespace Ui {
    class CMainWindow;
}
namespace greenhills {

namespace util {
    class CSerialPort;
    class CLineTerminal;
}

namespace gps {
    class CNMEAParser;
    class CGPS;
    class CEmulator;
    class CGPSPosition;
}

namespace client {

namespace core {
    class CClient;
}

class CRoom;
class CGPSInfoWidget;
class CNMEAPreviewWidget;
class CRoomItemsWidget;
class CTargetNavigationWidget;
class CCompas;
class CMapWiev;

class CMainWindow : public QMainWindow {
    Q_OBJECT
public:
    CMainWindow(util::CSerialPort *serialPort,
        util::CLineTerminal *lineTerminal, gps::CNMEAParser *nmeaParser,
        client::core::CClient &pClient, QWidget *pParent = 0);

    ~CMainWindow();

private:
    Ui::CMainWindow *mUi;

    //perhaps temporary location for these variables
    util::CSerialPort *mSerialPort;
    util::CLineTerminal *mLineTerminal;
    gps::CNMEAParser *mNmeaParser;
    gps::CGPS *mGps;
    gps::CEmulator *mGpsEmulator;
    client::core::CClient &mClient;

    //UI components
    client::CGPSInfoWidget *mGpsInfoWidget;
    client::CNMEAPreviewWidget *mNmeaPreviewWidget;
    client::CRoomItemsWidget *mRoomItemsWidget;
    client::CTargetNavigationWidget *mTargetNavigationWidget;
    client::CMapWiev * mMapWiev;
    QTableView *mRoomView;

private Q_SLOTS:
    void on_actionLogin_triggered();
    void on_actionLogout_triggered();
    void on_actionCreate_triggered();
    void on_actionJoin_triggered();
    void on_actionLeave_triggered();
    void on_actionGpsConnect_triggered();
    void on_actionGpsDisconnect_triggered();
    void on_actionSettings_triggered();
    void on_actionEmulatorStart_triggered();
    void on_actionEmulatorStop_triggered();
    void on_actionAddWaypoint_triggered();
    void on_actionNavigateToTarget_triggered();
    void on_actionNavigateToCurrentPosition_triggered();
    void on_actionNavigationCancel_triggered();

    void onRoomJoined();
    void onRoomLeft();
    void onUserLoggedIn();
    void onUserLoggedOut();
};

} // namespace client
} //namespace greenhills
